<title>全局配置</title>
<div class="layui-fluid">
    <div class="layui-col-md12">
        <form class="layui-form layui-col-md11">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input name="searchName" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <a class="layui-btn" lay-submit lay-filter="find">查询</a>
                </div>
            </div>
        </form>
        <a class="layui-btn layui-col-md1" lay-submit lay-filter="showAdd">新增</a>
    </div>
    <!--弹出层-->
    <form class="layui-form" style='display:none;' id="add_edit_form">
        <div class="layui-form-item">
            <label class="layui-form-label">类目</label>
            <div class="layui-input-inline">
                <select name="category_id" id="category_id"> </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-inline">
                <input name="title" required lay-verify="required" placeholder="请输入标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-block">
                <textarea name="content" required lay-verify="required" placeholder="请输入内容"
                          class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">键</label>
            <div class="layui-input-inline">
                <input name="key" required lay-verify="required" placeholder="请输入键" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">值类型</label>
            <div class="layui-input-inline">
                <select name="type" id="type" lay-filter="type">
                    <option value="1">数值</option>
                    <option value="2">字符串</option>
                    <option value="3">数组</option>
                </select>
            </div>
            <div class="layui-btn addIcon" style="float: right;display: none;">+</div>
        </div>
        <div class="elem">
            <div class="layui-form-item"><label class="layui-form-label">值</label>
                <div class="layui-input-inline"><input name="value" placeholder="请输入值" class="layui-input"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="text" name="valueK" required lay-verify="required" placeholder="请输入key"
                           class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <input type="text" name="valueV" required lay-verify="required" placeholder="请输入value"
                           class="layui-input">
                </div>
                <div class="layui-btn deleteIcon" style="float: right;">-</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="add_edit_status" checked lay-skin="switch" lay-text="开启|关闭">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" id="btn" lay-submit lay-filter="sub">提交</a>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        <!--当前打开弹窗的类型-->
        <input name="add_edit_type" style="display: none;"/>
    </form>
    <!--当前操作的id-->
    <input name="operationId" style="display: none;"/>
    <!--数据表格-->
    <div class="layui-col-md12">
        <table id="pageTable" lay-filter="pageTable" lay-data="{id: 'pageTable'}">
        </table>
    </div>
</div>
<!--添加/编辑签名-->
<script type="text/javascript">
    layui.use('set/config', layui.factory('set/config'));
</script>
<script type="text/html" id="operations">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
<!--值类型模板-->
<script type="text/html" id="typeTpl">
    {{#  if(d.type == '1'){ }}
    <span class="layui-col-md8">数值</span>
    {{#  } else if(d.type == '2'){ }}
    <span class="layui-col-md8">字符串</span>
    {{#  } else if(d.type == '3'){ }}
    <span class="layui-col-md8">数组</span>
    {{#  } else { }}
    <span class="layui-col-md8">类型错误</span>
    {{#  } }}
</script>
<!--状态码模板-->
<script type="text/html" id="statusTpl">
    <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="statusTpl" {{
           d.status== 1 ? 'checked' : '' }}>
</script>
<style>
    #add_edit_form {
        margin-top: 20px;
        margin-right: 20px;
    }
</style>
